Method and apparatus for coding/decoding image

ABSTRACT

Disclosed are a method and an apparatus for coding/decoding an image. The method for decoding the image comprises the steps of: deriving a scale factor of a current block, depending on whether the current block is a conversion skip block; and scaling the current block on the basis of the scale factor, wherein the scale factor of the current block is derived on the basis of the position of a conversion coefficient inside the current block, and wherein the conversion skip block is the current block to which conversion is not applied and is specified on the basis of information indicating whether to apply reconversion to the current block.

TECHNICAL FIELD

The present invention relates to the encoding/decoding of an image and,more particularly, to a method and apparatus for scaling a transformcoefficient.

BACKGROUND ART

Broadcast service having High Definition (HD) resolution (1280×1024 or1920×1080) is extended nationwide and globally. Accordingly, many usersare accustomed to video having high resolution and high picture quality.Accordingly, a lot of institutes are giving impetus to the developmentof the next-generation image device. Furthermore, as there is a growinginterest in Ultra High Definition (UHD) having resolution 4 times higherthan HDTV along with HDTV, moving image standardization organizationshave become recognized a need for compression technology for an imagehaving higher resolution and higher picture quality. Furthermore, thereis an urgent need for a new standard which can maintain the same picturequality and also have many advantages in terms of a frequency band orstorage through higher compression efficiency than that of H.264/AVCthat is now used in HDTV, mobile phones, and Blue ray players.

Today, Moving Picture Experts Group (MPEG) and Video Coding ExpertsGroup (VCEG) are jointly standardizing High Efficiency Video Coding(HEVC), that is, the next-generation video codec, and are aiming toencode an image including a UHD image with compression efficiency twicethan that of H.264/AVC. This can provide an image having a lowerfrequency than and higher picture quality than a current image even in3D broadcasting and a mobile communication network as well as HD and UHDimages.

DISCLOSURE Technical Problem

The present invention provides a method and apparatus for encoding anddecoding an image, which can improve encoding/decoding efficiency.

The present invention provides a method and apparatus for scalingtransform coefficients (or residual signal), which can improveencoding/decoding efficiency.

The present invention provides a method and apparatus forquantization/dequantization a transform skip block, which can improveencoding/decoding efficiency.

Technical Solution

In accordance with an aspect of the present invention, there is providedan image decoding method. The image decoding method includes deriving ascale factor for a current block depending on whether or not the currentblock is a transform skip block and performing scaling on the currentblock based on the scale factor.

The scale factor for the current block is derived based on a location ofa transform coefficient within the current block, and the transform skipblock is a block in which transform has not been applied to the currentblock and is specified based on information indicative of whether or notto apply inverse transform to the current block.

In deriving the scale factor for the current block, a basic scale factormay be derived irrespective of the location of the transform coefficientwithin the current block if the current block is the transform skipblock.

The basic scale factor may have a specific scale factor value, and thespecific scale factor value may be 16.

The basic scale factor may have a different scale factor value dependingon whether or not the current block uses a quantization matrix.

The basic scale factor may have a different scale factor value dependingon whether the current block is a luma block or a chroma block.

A flag indicating whether or not a transform skip algorithm is used in apicture including the current block is signaled through a PictureParameter Set (PPS).

The basic scale factor may include information about a scale factor fora luma signal and a chroma signal.

In deriving the scale factor for the current block, a basic scale factormay be derived irrespective of the location of the transform coefficientwithin the current block if the current block is the transform skipblock or the current block does not use a quantization matrix.

In deriving the scale factor for the current block, the scale factor forthe current block may be derived using a quantization matrix based onthe location of the transform coefficient within the current block ifthe current block is not a transform skip block.

In accordance with another aspect of the present invention, there isprovided an image decoding apparatus. The image decoding apparatusincludes a dequantization unit for deriving a scale factor for a currentblock depending on whether or not the current block is a transform skipblock and performing scaling on the current block based on the scalefactor.

The scale factor for the current block may be derived based on alocation of a transform coefficient within the current block, and thetransform skip block may be a block in which transform has not beenapplied to the current block and is specified based on informationindicative of whether or not to apply inverse transform to the currentblock.

In accordance with yet another aspect of the present invention, there isprovided an image encoding method. The image encoding method includesderiving a scale factor for a current block depending on whether or notthe current block is a transform skip block and performing scaling onthe current block based on the scale factor.

The scale factor for the current block may be derived based on alocation of a transform coefficient within the current block, and thetransform skip block may be a block in which transform has not beenapplied to the current block and is specified based on informationindicative of whether or not to apply inverse transform to the currentblock.

In deriving the scale factor for the current block, a basic scale factormay be derived irrespective of the location of the transform coefficientwithin the current block if the current block is the transform skipblock.

The basic scale factor may have a specific scale factor value, and thespecific scale factor value may be 16.

The basic scale factor may have a different scale factor value dependingon whether or not the current block uses a quantization matrix.

The basic scale factor may have a different scale factor value dependingon whether the current block is a luma block or a chroma block.

A flag indicating whether or not a transform skip algorithm is used in apicture including the current block is signaled through a PictureParameter Set (PPS).

The basic scale factor may include information about a scale factor fora luma signal and a chroma signal.

In deriving the scale factor for the current block, a basic scale factormay be derived irrespective of the location of the transform coefficientwithin the current block if the current block is the transform skipblock or the current block does not use a quantization matrix.

In deriving the scale factor for the current block, the scale factor forthe current block may be derived using a quantization matrix based onthe location of the transform coefficient within the current block ifthe current block is not a transform skip block.

In accordance with further yet another aspect of the present invention,there is provided an image encoding apparatus. The image encodingapparatus include a quantization unit for deriving a scale factor for acurrent block depending on whether or not the current block is atransform skip block and performing scaling on the current block basedon the scale factor.

The scale factor for the current block may be derived based on alocation of a transform coefficient within the current block, and thetransform skip block may be a block in which transform has not beenapplied to the current block and is specified based on informationindicative of whether or not to apply inverse transform to the currentblock.

Advantageous Effects

A block to which a transform skip algorithm has been applied has adifferent transform coefficient characteristic from an existing block onwhich a transform/inverse transform process has been performed becausethe transform/inverse transform process is not performed on the block towhich the transform skip algorithm has been applied. That is, if ascaling method applied to an existing block on which thetransform/inverse transform process has been performed is applied to atransform skip block, encoding/decoding efficiency can be reduced.Accordingly, encoding and decoding efficiency can be improved bylikewise applying a scale factor to a transform skip block irrespectiveof the location of a transform coefficient within a block.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram showing the construction of an image encodingapparatus to which an embodiment of the present invention is applied;

FIG. 2 is a block diagram showing the construction of an image decodingapparatus to which an embodiment of the present invention is applied;

FIG. 3 is a diagram schematically showing the partition structure of animage when encoding the image;

FIG. 4 is a diagram showing the forms of a PU that may be included in aCU;

FIG. 5 is a diagram showing the forms of a TU that may be included in aCU;

FIG. 6 is a flowchart illustrating a scaling method for a residualsignal (or transform coefficient) in accordance with an embodiment ofthe present invention; and

FIG. 7 is a flowchart illustrating a scaling method for a residualsignal (or transform coefficient) in accordance with another embodimentof the present invention.

MODE FOR INVENTION

Some exemplary embodiments of the present invention are described indetail with reference to the accompanying drawings. Furthermore, indescribing the embodiments of this specification, a detailed descriptionof the known functions and constitutions will be omitted if it is deemedto make the gist of the present invention unnecessarily vague.

In this specification, when it is said that one element is connected orcoupled with the other element, it may mean that the one element may bedirectly connected or coupled with the other element or a third elementmay be connected or coupled between the two elements. Furthermore, inthis specification, when it is said that a specific element is included,it may mean that elements other than the specific element are notexcluded and that additional elements may be included in the embodimentsof the present invention or the scope of the technical spirit of thepresent invention.

Terms, such as the first and the second, may be used to describe variouselements, but the elements are not restricted by the terms. The termsare used to only distinguish one element from the other element. Forexample, a first element may be named a second element without departingfrom the scope of the present invention. Likewise, a second element maybe named a first element.

Furthermore, element units described in the embodiments of the presentinvention are independently shown to indicate difference andcharacteristic functions, and it does not mean that each of the elementunits is formed of a piece of separate hardware or a piece of software.That is, the element units are arranged and included, for convenience ofdescription, and at least two of the element units may form one elementunit or one element may be divided into a plurality of element units andthe plurality of divided element units may perform functions. Anembodiment into which the elements are integrated or embodiments fromwhich some elements are separated are also included in the scope of thepresent invention, unless they depart from the essence of the presentinvention.

Furthermore, in the present invention, some elements are not essentialelements for performing essential functions, but may be optionalelements for improving only performance. The present invention may beimplemented using only essential elements for implementing the essenceof the present invention other than elements used to improve onlyperformance, and a structure including only essential elements otherthan optional elements used to improve only performance is included inthe scope of the present invention.

First, in order to improve convenience of description and helpunderstanding of the present invention, terms used in this specificationare described in brief.

A unit means an image encoding or decoding unit. In other words, when animage is encoded or decoded, an encoding or decoding unit refers to adivided unit of one image when the image is sub-divided and encoded ordecoded. The unit may also be called a block, a Macro Block (MB), aCoding Unit (CU), a Prediction Unit (PU), a Transform Unit (TU), aCoding Block (CB), a Prediction Block (PB), or a Transform Block (TB).One unit can be divided into smaller sub-units.

A block refers to an M×N array of samples. M and N have positive integervalues. A block may commonly mean an array of a 2-D form.

A Transform Unit (TU) is a basic unit when encoding/decoding areperformed on a residual signal, such as transform, inverse transform,quantization, dequantization, and the encoding/decoding of transformcoefficients. One TU can be partitioned into a plurality of smaller TUs.Here, if the residual signal is present in a block form, the residualsignal can be called a residual block.

A quantization matrix means a matrix used in a quantization ordequantization process in order to improve the subjective or objectivepicture quality of an image. The quantization matrix is also called ascaling list.

A quantization matrix can be divided into a default matrix, anon-default matrix, and a flat matrix. The default matrix can mean aspecific quantization matrix predetermined in an encoder and a decoder.The non-default matrix may not be predetermined in an encoder and adecoder, but may mean a quantization matrix transmitted or received by auser. The flat matrix may mean a matrix in which all elements have thesame value.

Scaling refers to a process of multiplying a transform coefficient levelby a factor. As a result of the process, a transform coefficient isgenerated. Scaling is also called dequantization.

A transform coefficient refers to a coefficient value generated aftertransform is performed. In this specification, a quantized transformcoefficient level obtained by applying quantization to a transformcoefficient is also called a transform coefficient.

A quantization parameter refers to a value used to scale a transformcoefficient level in quantization and dequantization. Here, thequantization parameter may be a value mapped to a quantization stepsize.

A parameter set corresponds to information about a header in a structurewithin a bit stream. The parameter set has a meaning that commonlydesignates a sequence parameter set, a picture parameter set, and anadaptation parameter set.

FIG. 1 is a block diagram showing the construction of an image encodingapparatus to which an embodiment of the present invention is applied.

Referring to FIG. 1, the image encoding apparatus 100 includes a motionestimation module 111, a motion compensation module 112, anintra-prediction module 120, a switch 115, a subtractor 125, a transformmodule 130, a quantization module 140, an entropy encoding module 150, adequantization module 160, an inverse transform module 170, an adder175, a filter module 180, and a reference picture buffer 190.

The image encoding apparatus 100 can perform encoding on an input imagein intra-mode or inter-mode and output a bit stream. In the case ofintra-mode, the switch 115 can switch to intra mode. In the case ofinter-mode, the switch 115 can switch to inter-mode. Intra-predictionmeans intra-frame prediction, and inter-prediction means inter-frame.The image encoding apparatus 100 can generate a prediction block for theinput block of the input image and then encode a difference between theinput block and the prediction block. Here, the input image can mean theoriginal picture.

In the case of intra-mode, the intra-prediction module 120 can generatethe prediction block by performing spatial prediction using a value ofthe pixel of an already encoded block neighboring a current block.

In the case of inter-mode, the motion estimation module 111 can obtain amotion vector by searching a reference picture, stored in the referencepicture buffer 190, for a region that is most well matched with theinput block in a motion prediction process. The motion compensationmodule 112 can generate the prediction block by performing motioncompensation using the motion vector and the reference picture stored inthe reference picture buffer 190. Here, the motion vector is atwo-dimensional (2-D) vector used in inter-prediction, and the motionvector can indicate an offset between a picture to be nowencoded/decoded and a reference picture.

The subtractor 125 can generate a residual block based on the differencebetween the input block and the generated prediction block.

The transform module 130 can perform transform on the residual block andoutput a transform coefficient according to the transformed block.Furthermore, the quantization module 140 can output a quantizedcoefficient by quantizing the received transform coefficient accordingto a quantization parameter.

The entropy encoding module 150 can perform entropy encoding on a symbolaccording to a probability distribution based on values calculated bythe quantization module 140, an encoding parameter value calculated inan encoding process, etc. and output a bit stream according to theentropy-coded symbols. If entropy encoding is applied, the size of a bitstream for a symbol to be encoded can be reduced because the symbol isrepresented by allocating a small number of bits to a symbol having ahigh incidence and a large number of bits to a symbol having a lowincidence. Accordingly, the compression performance of image encodingcan be improved through entropy encoding. The entropy encoding module150 can use such encoding methods as exponential Golomb,Context-Adaptive Binary Arithmetic Coding (CABAC), and Context-AdaptiveBinary Arithmetic Coding (CABAC) for the entropy encoding.

The image encoding apparatus 100 according to the embodiment of FIG. 1performs inter-prediction encoding, that is, inter-frame predictionencoding, and thus a picture that has been coded needs to be decoded andstored in order to be used as a reference picture. Accordingly, aquantized coefficient is dequantization by the dequantization module 160and inverse transformed by the inverse transform module 170. Thedequantized and inversely transformed coefficient is added to theprediction block through the adder 175, thereby generating areconstructed block.

The reconstructed block experiences the filter module 180. The filtermodule 180 can apply one or more of a deblocking filter, a SampleAdaptive Offset (SAO), and an Adaptive Loop Filter (ALF) to thereconstructed block or the reconstructed picture. The filter module 180may also be called an adaptive in-loop filter. The deblocking filter canremove block distortion generated at the boundary of blocks. The SAO canadd a proper offset value to a pixel value in order to compensate for acoding error. The ALF can perform filtering based on a value obtained bycomparing a reconstructed picture with the original picture. Thereconstructed block that has experienced the filter module 180 can bestored in the reference picture buffer 190.

FIG. 2 is a block diagram showing the construction of an image decodingapparatus to which an embodiment of the present invention is applied.

Referring to FIG. 2, the image decoding apparatus 200 includes anentropy decoding module 210, a dequantization module 220, an inversetransform module 230, an intra-prediction module 240, a motioncompensation module 250, a filter module 260, and a reference picturebuffer 270.

The image decoding apparatus 200 can receive a bit stream outputted froman encoder, perform decoding on the bit stream in intra-mode orinter-mode, and output a reconstructed image, that is, a reconstructedimage. In the case of intra-mode, a switch can switch to intra-mode. Inthe case of inter-mode, the switch can switch to inter-mode.

The image decoding apparatus 200 can obtain a reconstructed residualblock from the received bit stream, generate a prediction block, andgenerate a reconstructed block, that is, a restoration block, by addingthe reconstructed residual block to the prediction block.

The entropy decoding module 210 can generate symbols including a symbolhaving a quantized coefficient form by performing entropy decoding onthe received bit stream according to a probability distribution.

If an entropy decoding method is applied, the size of a bit stream foreach symbol can be reduced because the symbol is represented byallocating a small number of bits to a symbol having a high incidenceand a large number of bits to a symbol having a low incidence.

The quantized coefficient is dequantized by the dequantization module220 and is inversely transformed by the inverse transform module 230. Asa result of the dequantization/inverse transform of the quantizedcoefficient, a reconstructed residual block can be generated.

In the case of intra-mode, the intra-prediction module 240 can generatethe prediction block by performing spatial prediction using a value ofthe pixel of an already encoded block neighboring a current block. Inthe case of inter-mode, the motion compensation module 250 can generatethe prediction block by performing motion compensation using a motionvector and a reference picture stored in the reference picture buffer270.

The residual block and the prediction block are added together by anadder 255. The added block experiences the filter module 260. The filtermodule 260 can apply at least one of a deblocking filter, an SAO, and anALF to the reconstructed block or the reconstructed picture. The filtermodule 260 outputs a reconstructed image, that is, a reconstructedimage. The reconstructed image can be stored in the reference picturebuffer 270 and can be used for inter-frame prediction.

FIG. 3 is a diagram schematically showing the partition structure of animage when encoding the image.

In High Efficiency Video Coding (HEVC), encoding is performed in acoding unit in order to efficiency partition an image.

Referring to FIG. 3, in HEVC, an image 300 is sequentially partitionedin the Largest Coding Unit (hereinafter referred to as an LCU), and apartition structure is determined based on the LCUs. The partitionstructure means a distribution of Coding Units (hereinafter referred toas CUs) for efficiently encoding an image within the LCU 310. Thisdistribution can be determined based on whether or not one CU will bepartitioned into four CUs each reduced by half from the one CU in awidth size and a height size. Likewise, the partitioned CU can berecursively partitioned into four CUs each reduced by half from thepartitioned CU in a width size and a height size.

Here, the partition of a CU can be recursively performed up to apredetermined depth. Information about the depth is informationindicative of the size of a CU, and information about the depth of eachCU is stored. For example, the depth of an LCU can be 0, and the depthof the Smallest Coding Unit (SCU) can be a predetermined maximum depth.Here, the LCU is a CU having a maximum CU size as described above, andthe SCU is a CU having a minimum CU size.

Whenever partition is performed from the LCU 310 by half in a width sizeand a height size, the depth of a CU is increased by 1. A CU on whichpartitions has not been performed has a 2N×2N size for each depth, and aCU on which partition is performed is partitioned from a CU having a2N×2N size to four CUs each having an N×N size. The size of N is reducedby half whenever the depth is increased by 1.

Referring to FIG. 3, the size of the LCU having a minimum depth of 0 canbe 64×64 pixels, and the size of the SCU having a maximum depth of 3 canbe 8×8 pixels. Here, the LCU having 64×64 pixels can be represented by adepth of 0, a CU having 32×32 pixels can be represented by a depth of 1,a CU having 16×16 pixels can be represented by a depth of 2, and the SCUhaving 8×8 pixels can be represented by a depth of 3.

Furthermore, information about whether or not a specific CU will bepartitioned can be represented through partition information of 1 bitfor each CU. The partition information can be included in all CUs otherthan the SCU. For example, if a CU is not partitioned, partitioninformation of 0 can be stored. If a CU is partitioned, partitioninformation of 1 can be stored.

Meanwhile, a CU partitioned from the LCU can include a Prediction Unit(PU) (or Prediction Block (PB)), that is, a basic unit for prediction,and a Transform Unit (TU) (or Transform Block (TB)), that is, a basicunit for transform.

FIG. 4 is a diagram showing the forms of a PU that may be included in aCU.

A CU that is no longer partitioned, from among CUs partitioned from theLCU, is partitioned into one or more PUs. This behavior itself is alsocall partition. A Prediction Unit (hereinafter referred to as a PU) is abasic unit on which prediction is performed and encoded in any one ofskip mode, inter-mode, and intra mode. The PU can be partitioned invarious forms depending on each mode.

Referring to FIG. 4, in the case of skip mode, a 2N×2N mode 410 havingthe same size as a CU can be supported without partition within the CU.

In the case of inter-mode, 8 partitioned forms, for example, the 2N×2Nmode 410, a 2N×N mode 415, an N×2N mode 420, an N×N mode 425, a 2N×nUmode 430, a 2N×nD mode 435, an nL×2N mode 440, and an nR×2N mode 445 canbe supported within a CU.

In the case of intra-mode, the 2N×2N mode 410 and the N×N mode 425 canbe supported within a CU.

FIG. 5 is a diagram showing the forms of a TU that may be included in aCU.

A Transform Unit (hereinafter referred to as a TU) is a basic unit usedfor spatial transform and a quantization/dequantization (scaling)process within a CU. A TU can have a rectangular or square form. A CUthat is no longer partitioned, from among CUs partitioned from the LCU,can be partitioned into one or more TUs.

Here, the partition structure of the TU can be a quad-tree structure.For example, as shown in FIG. 5, one CU 510 can be partitioned once ormore depending on a quad-tree structure, thus form TUs having varioussizes.

Meanwhile, in HEVC, as in H.264/AVC, inter-frame prediction (hereinafterreferred to as intra-prediction) encoding can be performed. Here,encoding can be performed by deriving intra-prediction mode (orprediction directivity) for a current block from neighboring blockslocated near the current block.

As described above, a prediction image for a signal obtained byperforming prediction based on intra-prediction mode can have adifference value from the original image. A residual image having thedifference value between the prediction image and the original image canbe subject to entropy encoding after experiencing frequency regiontransform and quantization. Here, in order to increase encodingefficiency of the frequency region transform, integer transform,Discrete Cosine Transform (DCT), Discrete Sine Transform (DST), orDCT/DST dependent on intra-prediction mode can be applied selectivelyand adaptively depending on the size of a block.

Furthermore, in order to increase encoding efficiency in screencontents, such as a document image or a presentation image inPowerPoint, a transform skip algorithm can be used.

If the transform skip algorithm is used, an encoder directly quantizes aresidual image (or residual block) having a difference value between theoriginal image and a prediction image without a frequency transformprocess and performs entropy encoding on the residual block.Furthermore, a decoder performs entropy decoding on the residual blockand generates a reconstructed residual block by performingdequantization (scaling) on the entropy-decoded block. Accordingly, ablock on which the transform skip algorithm has been applied skips afrequency transform/inverse transform process.

In a quantization/dequantization process, a scale factor can bedifferently applied depending on the location of a transform coefficientwithin a block in order to improve the subject picture quality of animage. In contrast, there is a method of equally applying a scale factorirrespective of the location of a transform coefficient within a blockwhen performing quantization/dequantization. Whether or not to applythis method can be signaled through the Sequence Parameter Set (SPS) orPicture Parameter Set (PPS) of a bit stream.

As an embodiment of the process, a scaling process for transformcoefficient can be performed as follows.

Scaling process for transform coefficients In this case, input is asfollows.

-   -   The width of a current transform block; nW    -   The height of the current transform block; nH    -   An array of transform coefficients having an element c_(ij);        (nW×nH) array d    -   An index for the luma signal and the chroma signal of the        current block; cIdx

If cIdx is 0, it means a luma signal. If cIdx is 1 or cIdx is 2, itmeans a chroma signal. Furthermore, if cIdx is 1, it means Cb in achroma signal. I cIdx is 2, it means Cr in a chroma signal.

-   -   A quantization parameter; qP

In this case, output is as follows.

-   -   An array of scaled transform coefficients; (nW×nH) array d_(ij)

A parameter ‘log 2TrSize’ is derived through log 2TrSize=(Log 2 (nW)+Log2 (nH))>>1. A parameter shift is differently derived depending on cIdx.If cIx is 0 (in the case of a luma signal), the parameter shift isderived from ‘shift=BitDepth_(Y)+log 2TrSize−5’. If not (in the case ofa chroma signal), the parameter shift is derived from‘shift=BitDepth_(C)+log 2TrSize−5’. Here, BitDepth_(Y) and BitDepth_(C)mean the number of bits (e.g., 8 bits) of a sample for a current image.

An array ‘levelScale[ ]’ for scaling parameters is the same as Equation1 below.

[Equation 1]

levelScale[k]={40,45,51,57,64,72} with k=0 . . . 5

A scaled transform coefficient is calculated through the followingprocess.

First, a scale factor m_(ij) is derived through the following process.

-   -   If scaling_list_enable_flag is 0, the scale factor m_(ij) is        derived as in Equation 2 below.

[Equation 2]

m _(ij)=16

-   -   If not, the scale factor m_(ij) is derived as in Equation 3        below.

[Equation 3]

m _(ij)=ScalingFactor[SizeID][RefMatrixID][trafoType][i*nW+j]

In Equation 3, SizeID is derived through Table 1 below according to thesize of a transform block, and RefMatrixID and trafoType are derivedfrom Equation 4 and Equation 5 below, respectively. Furthermore, inEquation 4, scaling_list_pred_matrix_id_delta is signaled through theSequence Parameter Set (SPS) or a Picture Parameter Set (PPS) of a bitstream.

[Equation 4]

RefMatrixID=MatrixID−scaling_list_pred_matrix_id_delta

[Equation 5]

trafoType=((nW==nH)?0:((nW>nH)?1:2))

Table 1 is an example showing a SizeID value according to the size of atransform block.

TABLE 1 Size of quantization matrix SizeID 4x4 0 8x8 (16x4, 4x16) 116x16 (32x8, 8x32) 2 32x32 3

Next, a scaled transform coefficient d_(ij) is derived from Equation 6below.

[Equation 6]

d _(ij)=Clip3(−32768,32767,((c _(ij) *m _(ij)*levelScale[qP%6]<<(qP/6))+(1<<(shift−1)))>>shift)

Meanwhile, a frequency transform process is not performed on a block towhich the transform skip algorithm has been applied as described above(hereinafter referred to as a transform skip block). Accordingly, anexisting block on which the frequency transform process has beenperformed and a transform skip block can have different transformcoefficient characteristics. That is, if a scaling method applied to anexisting block on which the frequency transform process has beenperformed is applied to a transform skip block without change, encodingefficiency can be reduced.

Accordingly, the present invention provides a method of performingscaling by taking a case where a block is a transform skip block intoconsideration.

If a quantization matrix (default matrix and non-default matrix) is usedin an encoder and a decoder in order to improve the subjective picturequality of an image, a scale factor derived from the quantization matrixcan be differently applied depending on the location of a transformcoefficient within a block. In this method, quantization having agreater quantization step size is performed on a high frequency regionthat is less sensitive to an eye of a person rather than a low frequencyregion that is sensitive to an eye of a person by using a characteristicin which the energy of a residual block is compressed into the left top(i.e., low frequency region) of the block when transforming the block.In accordance with this method, subjective picture quality for a regionsensitive to an eye of a person can be improved when encoding an image.

If the transform skip algorithm is applied, however, a residual block isnot compressed toward a low frequency region within the residual blockbecause frequency region transform/inverse transform is not performed onthe residual block. In this case, if a quantization/dequantizationmethod used in an existing frequency region is applied, there is adisadvantage in that distortion within an image or block becomes severe.Accordingly, if a quantization matrix is used within an image, there isa need for a scaling (quantization/dequantization) method capable ofreducing distortion within an image or block in a block on whichfrequency region transform/inverse transform is not performed (i.e.,transform skip block). For example, there is a method of not applying aquantization matrix to a transform skip block. In this method, a basicscale factor can be equally applied irrespective of the location of atransform coefficient within a block.

Embodiment 1 A Method and Apparatus for Equally Applying a Scale Factorto a Transform Skip Block Irrespective of the Location of a TransformCoefficient within the Block

FIG. 6 is a flowchart illustrating a scaling method for a residualsignal (or transform coefficient) in accordance with an embodiment ofthe present invention.

The scaling method of FIG. 6 can be performed in the encoding apparatusof FIG. 1 or the decoding apparatus of FIG. 2. More particularly, thescaling method of FIG. 6 can be performed in the quantization unit orthe dequantization unit of FIG. 1 or 2. In the embodiment of FIG. 6, thescaling method of FIG. 6 is illustrated as being performed in theencoding apparatus for convenience of description, but the scalingmethod of FIG. 6 can be equally applied in the decoding apparatus.

Referring to FIG. 6, a scale factor m_(ij) applied when performingscaling (quantization or dequantization) on a residual signal (ortransform coefficient) within a current block can be derived dependingon whether or not the current block is a transform skip block.

The encoding apparatus determines whether or not a current block is atransform skip block at step S600.

Whether or not the current block is a transform skip block can bedetermined based on information indicating whether or not the currentblock is a transform skip block. For example, the information indicatingwhether or not the current block is a transform skip block can be a flag‘transSkipFlag’. A value of the flag ‘transSkipFlag’ can be derived byperforming entropy decoding on information about a transform skip blockwithin a bit stream. If the current block is a transform skip block, avalue of the flag ‘transSkipFlag’ can be 1. If the current block is nota transform skip block, a value of the flag ‘transSkipFlag’ can be 0.

If, as a result of the determination, it is determined that the currentblock is a transform skip block (e.g., a value of the flag‘transSkipFlag’ is 1), the encoding apparatus derives a scale factorm_(ij) irrespective of the location of a residual signal (or transformcoefficient) within the current block at step S610.

Here, as shown in FIG. 6, the scale factor m_(ij) can be set to aspecific basic scale factor value T. For example, the specific basicscale factor value T can be 16.

If, as a result of the determination, it is determined that the currentblock is not a transform skip block (e.g., a value of the flag‘transSkipFlag’ is 0), the encoding apparatus derives a scale factorm_(ij)) based on the location of a residual signal (or transformcoefficient) within the current block at step S620.

Here, the scale factor m_(ij) can be differently set depending on theresidual signal (or transform coefficient) within the current blockusing the quantization matrix. The scale factor m_(ij) can be derived asin Equation 7 below, as shown in FIG. 6.

[Equation 7]

m _(ij)=ScalingFactor[SizeID][RefMatrixID][trafoType][i*nW+j]

In Equation 7, ScalingFactor is an array in which scale factors arestored. SizeID can be a value indicating the size of the current block(transform block or quantization matrix), and a value of SizeID can bederived depending on the size of the current block (transform block) asin Table 1 above. RefMatrixID and trafoType can be derived from Equation8 and Equation 9 below, respectively. nW is the width of the currentblock.

[Equation 8]

RefMatrixID=MatrixID−scaling_list_pred_matrix_id_delta

In Equation 8, a value of MatrixID can mean the type of quantizationmatrix according to prediction mode and a color component. For example,a value of MatrixID can be derived as in Table 2 below.scaling_list_pred_matrix_id_delta is signaled through the SequenceParameter Set (SPS) or Picture Parameter Set (PPS) of a bit stream.

[Equation 9]

trafoType=((nW==nH)?0:((nW>nH)?1:2))

In Equation 9, nW means the width of the current block, and nH means theheight of the current block.

Table 2 shows MatrixID values according to prediction mode and colorcomponents.

TABLE 2 cIdx SizeID CuPredMode (colour component) matrixId 0, 1, 2MODE_INTRA 0(Y) 0 0, 1, 2 MODE_INTRA 1(Cb) 1 0, 1, 2 MODE_INTRA 2(Cr) 20, 1, 2 MODE_INTER 0(Y) 3 0, 1, 2 MODE_INTER 1(Cb) 4 0, 1, 2 MODE_INTER2(Cr) 5 3 MODE_INTRA 0(Y) 0 3 MODE_INTER 0(Y) 1

FIG. 7 is a flowchart illustrating a scaling method for a residualsignal (or transform coefficient) in accordance with another embodimentof the present invention.

The scaling method of FIG. 7 can be performed in the encoding apparatusof FIG. 1 or the decoding apparatus of FIG. 2. More particularly, thescaling method of FIG. 7 can be performed in the quantization unit orthe dequantization unit of FIG. 1 or 2. In the embodiment of FIG. 7, thescaling method of FIG. 7 is illustrated as being performed in theencoding apparatus for convenience of description, but the scalingmethod of FIG. 7 can be equally applied in the decoding apparatus.

Referring to FIG. 7, a scale factor m_(ij) applied when performingscaling (quantization or dequantization) on the residual signal (ortransform coefficient) of a current block can be derived depending onwhether or not the current block is a transform skip block and whetheror not a quantization matrix is used.

The encoding apparatus determines whether or not a current block uses aquantization matrix and whether or not the current block is a transformskip block at step S700.

Whether or not the current block uses a quantization matrix can bedetermined based on information indicating whether or not the currentblock uses a quantization matrix. For example, the informationindicating whether or not the current block uses a quantization matrixcan be a flag ‘scaling_list_enable_flag’. A value of the flag‘scaling_list_enable_flag’ can be derived by performing entropy decodingon information about the use of a quantization matrix within a bitstream. If the current block uses a quantization matrix, a value of theflag ‘scaling_list_enable_flag’ can be 1. If the current block does notuse a quantization matrix, a value of the flag‘scaling_list_enable_flag’ can be 0.

Furthermore, whether or not the current block is a transform skip blockcan be determined based on information indicating whether or not thecurrent block is a transform skip block. For example, the informationindicating whether or not the current block is a transform skip blockcan be a flag ‘transSkipFlag’. A value of the flag ‘transSkipFlag’ canbe derived by performing entropy decoding on information about atransform skip block within a bit stream. If the current block is atransform skip block, a value of the flag ‘transSkipFlag’ can be 1. Ifthe current block is not a transform skip block, a value of the flag‘transSkipFlag’ can be 0.

If, as a result of the determination, it is determined that the currentblock is a transform skip block or the current block does not use aquantization matrix (e.g., transSkipFlag==1 orscaling_list_enable_flag==0), the encoding apparatus derives a scalefactor m_(ij) irrespective of the location of a residual signal (ortransform coefficient) within a current block at step S710.

As shown in FIG. 7, the scale factor m_(ij) can be set to a specificbasic scale factor value T. For example, the specific basic scale factorvalue T can be 16.

If, as a result of the determination, it is determined that the currentblock is not a transform skip block and the current block uses aquantization matrix, the encoding apparatus derives a scale factorm_(ij) based on the location of a residual signal (or transformcoefficient) within the current block at step S720.

The scale factor m_(ij) can be differently set depending on the locationof the residual signal (or transform coefficient) within the currentblock using the quantization matrix and can be derived as in an equationshown at step S720 of FIG. 7. The scale factor m_(ij) derived by theequation shown at step S720 has been described with reference to stepS620 of FIG. 6, and a description thereof is omitted.

As described above with reference to FIGS. 6 and 7, if a current block(i.e., a target block to be encoded or decoded now) is a transform skipblock, a scale factor having the specific value T has been applied tothe current block (i.e., transform skip block) irrespective of thelocation of a coefficient (or signal) within the current block. Here, avalue of the scale factor according to an embodiment of the presentinvention may be differently set depending on various encodingparameters applied to a corresponding block.

For example, a value of the scale factor to be applied to acorresponding block can be set as follows depending on a value of aparameter (e.g., scaling_list_enable_flag) indicating whether or not aquantization matrix is used.

-   -   If a quantization matrix is used (e.g.,        scaling_list_enable_flag==1), a basic scale factor value is set        to ‘T1’ (m_(ij)=T1)    -   If a quantization matrix is not used (e.g.,        scaling_list_enable_flag==0), a basic scale factor value is set        to ‘T2’ (m_(ij)=T2)

The T1 and/or T2 values may be determined and signaled by an encoder, orpredetermined T1 and/or T2 values may be used. If the T1 and/or T2values are signaled through a bit stream, a decoder can obtain the T1and/or T2 values by parsing the bit stream.

For another example, a value of the scale factor to be applied to acorresponding block can be set as follows based on a value ofinformation (e.g., color component index cIdx) on which a colorcharacteristic for the signal of the corresponding block can be derived.The color component index cIdx indicates a luma signal (i.e., Y signal)or a chroma signal (i.e., Cb signal or Cr signal) depending on itsvalue.

Example 1

a basic scale factor value is set to ‘Ty’ or ‘Tc’ depending on whetheror not the signal of a corresponding block is a luma signal. Forexample, if the signal of the corresponding block is a luma signal, thebasic scale factor value is set to ‘Ty’. If the signal of thecorresponding block is not a luma signal (i.e., chroma signal), thebasic scale factor value is set to ‘Tc’.

Example 2

a basic scale factor value is set according to each color component of acorresponding block. For example, if the color component of thecorresponding block is a luma signal (i.e., Y signal), the basic scalefactor value is set to ‘Ty’. If a chroma signal is a Cb signal, thebasic scale factor value is set to ‘Tcb’. If the chroma signal is a Crsignal, the basic scale factor value is set to ‘Tcr’.

Here, the Ty, Tc, Tcb and/or Tcr values may be determined and signaledby an encoder, or predetermined Ty, Tc, Tcb and/or Tcr values may beused. If the Ty, Tc, Tcb and/or Tcr values are signaled through a bitstream, a decoder can obtain the Ty, Tc, Tcb and/or Tcr values byparsing the bit stream.

The methods of determining the basic scale factor depending on theencoding parameters according to the embodiments of the presentinvention may be applied independently or in combination, but the samescale factor value needs to be always applied to the same transform skipblock irrespective of the location of a coefficient (or signal) withinthe block (i.e., target block to be encoded or decoded).

A scaling process for transform coefficients into which the embodimentsof the present invention have been incorporated can be performed asfollows.

Scaling Process for Transform Coefficients

In this case, input is as follows.

-   -   The width of a current transform block; nW    -   The height of the current transform block; nH    -   An array of transform coefficients having an element c_(ij);        (nW×nH) array d    -   Information indicating whether or not the transform skip        algorithm has been applied to the current transform block    -   An index for the luma signal and the chroma signal of the        current transform block; cIdx

If cIdx is 0, it means a luma signal. If cIdx is 1 or cIdx is 2, itmeans a chroma signal. Furthermore, if cIdx is 1, it means Cb in achroma signal. If cIdx is 2, it means Cr in a chroma signal.

-   -   A quantization parameter; qP

In this case, output is as follows.

-   -   An array of scaled transform coefficients; (nW×nH) array d_(ij)

A parameter ‘log 2TrSize’ is derived through ‘log 2TrSize=(Log 2(nW)+Log 2 (nH))>>1’. A parameter shift is differently derived accordingto cIdx. If cIx is 0 (i.e., in the case of a luma signal), the parametershift is derived from ‘shift=BitDepth_(Y)+log 2TrSize−5’. If not (i.e.,in the case of a chroma signal), the parameter shift is derived from‘shift=BitDepth_(C)+log 2TrSize−5’. Here, BitDepth_(Y) and BitDepth_(C)mean the number of bits (e.g., 8 bits) of a sample for a current image.

An array ‘levelScale[ ]’ of scaling parameters is the same as Equation10.

[Equation 10]

levelScale[k]={40,45,51,57,64,72} with k=0 . . . 5

A scaled transform coefficient is calculated through the followingprocess.

First, a scale factor m_(ij) is derived through the following process.

-   -   If scaling_list_enable_flag is 0 or the current transform block        is a transform skip block, the scale factor m_(ij) is derived as        in Equation 11 below.

[Equation 11]

m _(ij)=16

-   -   If not, the scale factor m_(ij) is derived as in Equation 12        below.

[Equation 12]

m _(ij)=ScalingFactor[SizeID][RefMatrixID][trafoType][i*nW+j]

In Equation 12, SizeID is derived through Table 1 above according to thesize of a transform block, and RefMatrixID and trafoType are derivedfrom Equation 13 and Equation 14 below, respectively. Furthermore, inEquation 13, scaling_list_pred_matrix_id_delta is signaled through theSequence Parameter Set (SPS) of a bit stream.

[Equation 13]

RefMatrixID=MatrixID−scaling_list_pred_matrix_id_delta

[Equation 14]

trafoType=((nW==nH)?0:((nW>nH)?1:2))

Next, a scaled transform coefficient d_(ij) is derived from Equation 15below.

[Equation 15]

d _(ij);=Clip3(−32768,32767,((c _(ij) *m _(ij)*levelScale[qP%6]<<(qP/6))+(1<<(shift−1)))>>shift)

Meanwhile, an inverse transform process is performed on the transformcoefficient scaled through the scaling process as described above. Here,the inverse transform process is not performed, but only the followingshift operation process is performed on the current transform block towhich the transform skip algorithm has been applied.

1. If cIdx of a current block is 0 (in the case of a luma signal)shift=13−BitDepth_(Y). If not (in the case of a chroma signal),shift=13−BitDepth_(C).

2. An array r_(ij) (i=0 . . . (nW)−1, j=0 . . . (nH)−1) for a residualblock is set as follows.

If a shift is greater than 0, =(d_(ij)+(1<<(shift−1)))>>shift. If not,r_(ij)=(d_(ij)<<(−shift).

Here, d_(ij) is an array of the scaled transform coefficients, andr_(ij) means an array for a residual block obtained by performinginverse transform on the scaled transform coefficients.

As an embodiment into which the inverse transform process of the scaledtransform coefficient has been incorporated, a transform process for thescaled transform coefficients can be performed as follows.

Transform Process for Scaled Transform Coefficients

In this case, input is as follows.

-   -   The width of a current transform block; nW    -   The height of the current transform block; nH    -   An array of transform coefficients having an element d_(ij);        (nW×nH) array d    -   Information indicating whether or not the transform skip        algorithm has been applied to the current transform block    -   An index for the luma signal and the chroma signal of the        current transform block; cIdx

If cIdx is 0, it means a luma signal. If cIdx is 1 or cIdx is 2, itmeans a chroma signal. Furthermore, if cIdx is 1, it means Cb in achroma signal. If cIdx is 2, it means Cr in a chroma signal.

-   -   A quantization parameter; qP

In this case, output is as follows.

-   -   An array for a residual block obtained by performing inverse        transform on the scaled transform coefficients; (nW×nH) array r

If encoding mode ‘PredMode’ for a current block is intra-predictionmode, a value of Log 2(nW*nH) is 4, and a value of cIdx is 0, parameters‘horizTrType’ and ‘vertTrType’ are obtained through Table 3 belowdepending on intra-prediction mode of a luma signal. If not, theparameters ‘horizTrType’ and ‘vertTrType’ are set to 0.

Table 3 shows an example of values of the parameters ‘horizTrType’ and‘vertTrType’ according to intra-prediction mode.

TABLE 3 IntraPredMode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17vertTrType 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 horizTrType 1 0 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 IntraPredMode 18 19 20 21 22 23 24 25 26 27 28 2930 31 32 33 34 vertTrType 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 horizTrType1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0

A residual signal for the current block is obtained according to thefollowing sequence.

First, if the transform skip algorithm for the current block has beenapplied, the following process is performed.

1. If cIdx is 0, shift=13−BitDepth_(Y). If not, shift=13−BitDepth_(C).

2. An array r_(ij) (i=0 . . . (nW)−1, j=0 . . . (nH)−1) for the residualblock is set as follows.

-   -   If the shift is greater than 0,        r_(ij)=(d_(ij)+(1<<(shift−1)))>>shift. If not,        r_(ij)=(d_(ij)<<(−shift).

If the transform skip algorithm for the current block has not beenapplied, the following process is performed.

1. An inverse transform process is performed on scaled transformcoefficients using values of the parameters ‘horizTrType’ and‘vertTrType’. First, the size (nW, nH) of the current block, an array‘(nW×nH) array d’ for the scaled transform coefficients, and theparameter ‘horizTrType’ are received, and an array ‘(nW×nH) array e’ isoutputted by performing 1-dimensional inverse transform horizontally.

2. Next, the array ‘(nW×nH) array e’ is received, and the array ‘(nW×nH)array g’ is derived as in Equation 16.

[Equation 16]

g _(ij)=Clip3(−32768,32767,(e _(ij)+64)>>7)

3. Next, the size (nW, nH) of the current block, the array ‘nW×nH arrayg’, and the parameter ‘vertTrType’ are received, and 1-dimensionalinverse transform is performed horizontally.

4. Next, an array ‘(nW×nH) array r’ for the residual block is set as inEquation 17 below depending on cIdx.

[Equation 17]

r _(ij)=(f _(ij)+(1<<(shift−1)))>>shift

In Equation 17, the shift=20−BitDepth_(Y) when cIdx is 0. If not, theshift=20−BitDepth_(C). BitDepth means the number of bits (e.g., 8 bits)of a sample for the current image.

A reconstructed residual block can be generated by performing theabove-described scaling process on transform coefficients and theabove-described transform process on the scaled transform coefficients.Furthermore, a reconstructed block can be generated by adding aprediction block, generated through intra-prediction orinter-prediction, to the reconstructed residual block. Here, thereconstructed block may be a block to which a loop filter has beenapplied or a block to which a loop filter has not been applied.

Hereinafter, the present invention provides a method of signaling abasic scale factor derived depending on whether or not a current blockis a transform skip block.

In accordance with an embodiment of the present invention, the basicscale factor derived depending on whether or not a current block is atransform skip block can be signaled through a Sequence Parameter Set(SPS).

Table 4 shows an example of an SPS syntax for signaling informationabout a basic scale factor in accordance with an embodiment of thepresent invention.

TABLE 4 seq_parameter_set_rbsp( ) { Descriptor  ...... transform_skip_enabled_flag u(1)  if( transform_skip_enabled_flag ) {  flat_scale_factor_y_minus16 se(v)   flat_scale_factor_cb_minus16 se(v)  flat_scale_factor_cr_minus16 se(v)  }  ...... }

Referring to Table 4, transform_skip_enabled_flag indicates whether ornot the transform skip algorithm will be used in a current sequence.

If the transform skip algorithm is used in the current sequence,flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, andflat_scale_factor_cr_minus16 are signaled. Each of the values can beencoded (se(v)) in a form having a positive or negative sign. Or, eachof the values can be encoded (ue(v)) in a form having 0 and a positivesign.

flat_scale_factor_y_minus16 means a scale factor for a luma signal. Forexample, if a value of flat_scale_factor_y_minus16 is 0, the scalefactor for the luma signal has a value of 16 in which 16 has been addedto 0.

flat_scale_factor_cb_minus16 means a scale factor for a chroma signalCb. flat_scale_factor_cr_minus16 means a scale factor for a chromasignal Cr.

The scale factor for the luma signal or the chroma signal can be derivedas in Equation 18 to 20.

Here, the basic scale factor FlatScalingFactor[cIdx] stores a scalefactor for a luma signal and a chroma signal. For example, if a colorcomponent index cIdx is 0, the basic scale factor can indicate a luma(Y) signal. If the color component index cIdx is 1, the basic scalefactor can indicate a Cb chroma signal. If the color component indexcIdx is 2, the basic scale factor can indicate a Cr chroma signal.Furthermore, a value of the basic scale factor ‘FlatScalingFactor[cIdx]’can have a range of specific values. For example, an 8-bit signal canhave a value from −15 to ‘255−16’.

A basic scale factor for a luma signal can be derived as in Equation 18.

[Equation 18]

FlatScalingFactor[0]=16+(transform_skip_enabled_flag==1)?:flat_scale_factor_(—)y_minus16:0

A basic scale factor for a Cb chroma signal can be derived as inEquation 19.

[Equation 19]

FlatScalingFactor[1]=16+(transform_skip_enabled_flag==1)?:flat_scale_factor_cb_minus16:0

A basic scale factor for a Cr chroma signal can be derived as inEquation 20.

[Equation 20]

FlatScalingFactor[2]=16+(transform_skip_enabled_flag==1)?:flat_scale_factor_cr_minus16:0

A scaling process for transform coefficients can be performed as followsby incorporating the method of signaling a basic scale factor deriveddepending on whether or not a current block is a transform skip block inaccordance with the embodiment of the present invention into the scalingprocess.

Scaling Process for Transform Coefficients

In this case, input is as follows.

-   -   The width of a current transform block; nW    -   The height of the current transform block; nH    -   An array of transform coefficients having an element c_(ij);        (nW×nH) array d    -   Information indicating whether or not the transform skip        algorithm has been applied to the current transform block;        transSkipFlag

If a value of transSkipFlag is 1, it indicates that the transform skipalgorithm has been applied to the current block. If a value oftransSkipFlag is 0, it indicates that the transform skip algorithm hasnot been applied to the current block.

-   -   An index for the luma signal and the chroma signal of the        current block; cIdx

If cIdx is 0, it means a luma signal. If cIdx is 1 or cIdx is 2, itmeans a chroma signal. Furthermore, if cIdx is 1, it means Cb in achroma signal. If cIdx is 2, it means Cr in a chroma signal.

-   -   A quantization parameter; qP

In this case, output is as follows.

-   -   An array of scaled transform coefficients; (nW×nH) array d_(ij)

A parameter log 2TrSize is derived through log 2TrSize=(Log 2 (nW)+Log 2(nH))>>1. A parameter shift is differently derived depending on cIdx. IfcIx is 0 (in the case of a luma signal), the parameter shift is derivedfrom ‘shift=BitDepth_(Y)+log 2TrSize−5’. If not (i.e., in the case of achroma signal), the parameter shift is derived from‘shift=BitDepth_(C)+log 2TrSize−5’. Here, BitDepth_(Y) and BitDepth_(C)mean the number of bits (e.g., 8 bits) of a sample for a current image.

An array ‘levelScale[ ]’ for the scaling parameters is the same asEquation 21.

[Equation 21]

levelScale[k]={40,45,51,57,64,72} with k=0 . . . 5

A scaled transform coefficient is calculated through the followingprocess.

First, a scale factor m_(ij) is derived through the following process.

-   -   If scaling_list_enable_flag is 0, the scale factor m_(ij) is        derived as in Equation 22 below.

[Equation 22]

m _(ij)=(transSkipFlag==1)?FlatScaleFactor[cIdx]:16

-   -   If not (i.e., if scaling_list_enable_flag is 1), the scale        factor m_(ij) is derived as in Equation 23 below.

[Equation 23]

m_(ij)=(transSkipFlag==1)?FlatScaleFactor[cIdx]:ScalingFactor[SizeID][ReMatrixID][trafoType][i*nW+j]

In Equation 23, SizeID is derived through Table 1 above depending on thesize of a block. RefMatrixID and trafoType are derived from Equation 24and Equation 25 below, respectively. In Equation 24,scaling_list_pred_matrix_id_delta is signaled through the SequenceParameter Set (SPS) of a bit stream.

[Equation 24]

RefMatrixID=MatrixID−scaling_list_pred_matrix_id_delta

[Equation 25]

trafoType=((nW==nH)?0:((nW>nH)?1:2))

Next, a scaled transform coefficient dij is derived from Equation 26below.

[Equation 26]

d _(ij)=Clip3(−32768,32767,((c _(ij) *m _(ij)*levelScale[qP%6]<<(qP/6))+(1<<(shift−1)))>>shift)

Meanwhile, a basic scale factor derived depending on whether or not acurrent block is a transform skip block according to an embodiment ofthe present invention can be signaled through a Picture Parameter Set(PPS) or a slice header ‘SliceHeader’ in addition to the above-describedSPS. Furthermore, the basic scale factor may be signaled in a CU unit ora TU unit.

Values flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, andflat_scale_factor_cr_minus16 signaled through the above-described SPScan be updated in a PPS (or SliceHeader, CU, or TU) and used.

Table 5 shows an example of a PPS syntax for signaling information aboutthe basic scale factor in accordance with another embodiment of thepresent invention.

TABLE 5 pic_parameter_set_rbsp( ) { Descriptor  ...... transform_skip_enabled_flag u(1)  if( transform_skip_enabled_flag ) {  pps_flat_scaling_factor_present_flag u(1)   if(pps_flat_scaling_factor_present_flag ) {     flat_scale_factor_y_minus16se(v)     flat_scale_factor_cb_minus16 se(v)    flat_scale_factor_cr_minus16 se(v)    }  }  ...... }

Referring to Table 5, transform_skip_enabled_flag indicates whether ornot the transform skip algorithm will be used in a current picture. Ifthe transform skip algorithm is used, a value ofpps_flat_scaling_factor_present_flag is signaled.

For example, if a value of pps_flat_scaling_factor_present_flag is 0,flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, andflat_scale_factor_cr_minus16 applied to the above-described SPS are usedas scale factors for a transform skip block. If a value ofpps_flat_scaling_factor_present_flag is 1, corresponding values aresignaled in order to update values of flat_scale_factor_y_minus16,flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16 appliedin the above-described SPS.

The signaled values ‘flat_scale_factor_y_minus16,flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16’ are usedas scale factors for the transform skip block of a current picture.Here, the values continue to be used until they are not changed again.Or, the values may be applied to only a current picture, and scalefactor values used in an SPS may be applied to a next picture.

Here, each of the values ‘flat_scale_factor_y_minus16,flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16’ can beencoded (se(v)) in a form having a positive or negative sign. Or, eachof the values can be encoded (ue(v)) in a form having 0 and a positivesign.

The values ‘flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16,and flat_scale_factor_cr_minus16’ can be signaled with different valuesaccording to each luma signal and each chroma signal. For example, thevalue ‘flat_scale_factor_y_minus16’ can be used to signal a scale factorfor a luma signal, the value ‘flat_scale_factor_cb_minus16’ can be usedto signal a scale factor for a Cb chroma signal, and the value‘flat_scale_factor_cr_minus16’ can be used to signal a scale factor fora Cr chroma signal. Or, a scale factor for a luma signal may be signaledusing flat_scale_factor_y_minus16, and a scale factor for a chromasignal may be signaled using flat_scale_factor_cb_cr_minus16. Or, ascale factor for a luma signal and a chroma signal may be signaled usingone value ‘flat_scale_factor_y_cb_cr_minus16’.

As described above, the values ‘flat_scale_factor_y_minus16,flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16’ signaledin the SPS or PPS can be updated in SliceHeader (or CU or TU) and used.

Table 6 shows an example of a slice header ‘SliceHeader’ syntax forsignaling information about a basic scale factor in accordance with yetanother embodiment of the present invention.

TABLE 6 slice_header( ) { Descriptor  ......  if(transform_skip_enabled_flag ) {   flat_scaling_factor_override_flag u(1)  if( flat_scaling_factor_override_flag ) {    flat_scale_factor_y_delta se(v)     flat_scale_factor_cb_delta se(v)    flat_scale_factor_cr_delta se(v)    }  }  ...... }

Referring to Table 6, transform_skip_enabled_flag indicates whether ornot the transform skip algorithm will be used in a current slice. If thetransform skip algorithm will be used, a value offlat_scaling_factor_override_flag is signaled.

For example, if a value of flat_scaling_factor_override_flag is 0,flat_scale_factor_y_minus16, flat_scale_factor_cb_minus16, andflat_scale_factor_cr_minus16 applied in the above-described SPS or PPSare used as scale factors for a transform skip block. If a value offlat_scaling_factor_override_flag is 1, corresponding values aresignaled in order to update values of flat_scale_factor_y_minus16,flat_scale_factor_cb_minus16, and flat_scale_factor_cr_minus16 appliedin the above-described SPS or PPS.

The values ‘flat_scale_factor_y_delta, flat_scale_factor_cb_delta, andflat_scale_factor_cr_delta’ are used as scale factors for the transformskip block of the current slice.

Here, each of the values ‘flat_scale_factor_y_delta,flat_scale_factor_cb_delta, and flat_scale_factor_cr_delta’ can beencoded (se(v)) in a form having a positive or negative sign. Or, eachof the values can be encoded (ue(v)) in a form having 0 and a positivesign.

Each of ‘flat_scale_factor_y_delta, flat_scale_factor_cb_delta, andflat_scale_factor_cr_delta’ can be signaled with a different valueaccording to each luma signal and each chroma signal. For example, avalue of flat_scale_factor_y_delta can be used to signal a scale factorfor a luma signal, a value of flat_scale_factor_cb_delta can be used tosignal a scale factor for a Cb chroma signal, and a value offlat_scale_factor_cr_delta can be used to signal a scale factor for a Crchroma signal. Or, a scale factor for a luma signal may be signaledusing flat_scale_factor_y_delta, and a scale factor for a chroma signalmay be signaled using flat_scale_factor_cb_cr_delta. Or, scale factorsfor a luma signal and a chroma signal may be signaled using one value offlat_scale_factor_y_cb_cr_delta.

A basic scale factor can be derived as in Equations 27 to 29 below usingthe values ‘flat_scale_factor_y_delta, flat_scale_factor_cb_delta, andflat_scale_factor_cr_delta’ signaled as described above.

Here, the basic scale factor ‘FlatScalingFactor[cIdx]’ stores a scalefactor for a luma signal and a chroma signal. For example, if the colorcomponent index cIdx is 0, the basic scale factor can indicate a luma(Y) signal. If the color component index cIdx is 1, the basic scalefactor can indicate a Cb chroma signal. If the color component indexcIdx is 2, the basic scale factor can indicate a Cr chroma signal.Furthermore, a value of the basic scale factor ‘FlatScalingFactor[cIdx]’can indicate a range of specific values. For example, an 8-bit signalcan have a range from −15 to ‘255−16’.

A basic scale factor for a luma signal can be derived as in Equation 27using flat_scale_factor_y_delta.

[Equation 27]

FlatScalingFactor[0]=16+(transform_skip_enabled_flag==1)?:(flat_scale_factor_(—)y_minus16+flat_scale_factor_(—) y_delta):0

A basic scale factor for a Cb chroma signal can be derived as inEquation 28 using flat_scale_factor_cb_delta.

[Equation 28]

FlatScalingFactor[1]=16+(transform_skip_enabled_flag==1)?:(flat_scale_factor_cb_minus16+flat_scale_factor_cb_delta):0

A basic scale factor for a Cr chroma signal can be derived as inEquation 29 using flat_scale_factor_cr_delta.

[Equation 29]

FlatScalingFactor[2]=16+(transform_skip_enabled_flag==1)?:(flat_scale_factor_cr_minus16+flat_scale_factor_cr_delta):0

Meanwhile, the above-described embodiments can have a different range ofapplication depending on the size of a block, the depth of a CU, or thedepth of a TU. A parameter (e.g., information about the size or depth ofa block) that determines the range of application may be set by anencoder and a decoder so that the parameter has a predetermined value ormay be set to have a predetermined value according to a profile orlevel. When an encoder writes a parameter value into a bit stream, adecoder may obtain the value from the bit stream and use the value.

If the range of application is different depending on the depth of a CU,the following three methods can be applied to the above-describedembodiments as illustrated in Table 7. The method A is applied to only adepth having a specific depth or higher, the method B is applied to onlya depth having a specific depth or lower, and the method C is applied toonly a specific depth.

Table 7 shows an example of methods of determining a range in which themethods of the present invention are applied depending on the depth of aCU (or TU). In Table 7, a mark ‘0’ means that a corresponding method isapplied to a corresponding depth of a CU (or TU), and a mark ‘X’ meansthat a corresponding method is not applied to a corresponding depth of aCU (or TU).

TABLE 7 Depth of CU (or TU) indicating a range of application Method AMethod B Method C 0 X ◯ X 1 X ◯ X 2 ◯ ◯ ◯ 3 ◯ X X 4 or higher ◯ X X

Referring to Table 7, if the depth of a CU (or TU) is 2, all the methodA, the method B, and the method C can be applied to the embodiments ofthe present invention.

If the embodiments of the present invention are not applied to alldepths of a CU (or TU), it may be indicated using a specific indicator(e.g., flag) or may be represented by signaling a value one greater thana maximum value of the depth of a CU using a value of the depth of a CUindicative of a range of application.

Furthermore, the method of determining the range in which the methods ofthe present invention are applied depending on the above-described depthof a CU (or TU) can be differently applied depending on the sizes of aluma block and a chroma block and can be differently applied dependingon a luma image and a chroma image.

Table 8 shows an example schematically showing a combination of methodsof determining a range of application depending on the sizes of a lumablock and a chroma block.

TABLE 8 LUMA CHROMA BLOCK BLOCK LUMA CHROMA SIZE SIZE APPLIED APPLIEDMETHODS 4(4x4, 2(2x2) O or X O or X A 1, 2 , . . . 4x2, 2x4) 4(4x4, 4x2,2x4) O or X O or X B 1, 2 , . . . 8(8x8, 8x4, 4x8, 2x8, etc.) O or X Oor X C 1, 2 , . . . 16(16x16, 16x8, 4x16, O or X O or X D 1, 2 , . . .2x16, etc.) 32(32x32) O or X O or X E 1, 2 , . . . 8(8x8, 8x4, 2(2x2) Oor X O or X F 1, 2 , . . . 2x8, etc.) 4(4x4, 4x2, 2x4) O or X O or X G1, 2 , . . . 8(8x8, 8x4, 4x8, 2x8, etc.) O or X O or X H 1, 2 , . . .16(16x16, 16x8, 4x16, O or X O or X I 1, 2 , . . . 2x16, etc.) 32(32x32)O or X O or X J 1, 2 , . . . 16(16x16, 2(2x2) O or X O or X K 1, 2 , . .. 8x16, 4(4x4, 4x2, 2x4) O or X O or X L 1, 2 , . . . 4x16, etc.) 8(8x8,8x4, 4x8, 2x8, etc.) O or X O or X M 1, 2 , . . . 16(16x16, 16x8, 4x16,O or X O or X N 1, 2 , . . . 2x16, etc.) 32(32x32) O or X O or X O 1, 2, . . .

In the case of the method “G1” of the methods listed in Table 8, if thesize of the luma block is 8(8×8, 8×4, 2×8, etc.) and the size of thechroma block is 4(4×4, 4×2, 2×4), the embodiment 1 (G1—embodiment 1) ofthe present invention can be applied to a luma signal and a chromasignal and a horizontal signal and a vertical signal.

In the above-described embodiments, although the methods have beendescribed based on the flowcharts in the form of a series of steps orblocks, the present invention is not limited to the sequence of thesteps, and some of the steps may be performed in a different order fromthat of other steps or may be performed simultaneous to other steps.Furthermore, those skilled in the art will understand that the stepsshown in the flowchart are not exclusive and the steps may includeadditional steps or that one or more steps in the flowchart may bedeleted without affecting the scope of the present invention.

The above description is only an example of the technical spirit of thepresent invention, and those skilled in the art may change and modifythe present invention in various ways without departing from theintrinsic characteristic of the present invention. Accordingly, thedisclosed embodiments should not be construed as limiting the technicalspirit of the present invention, but should be construed as illustratingthe technical spirit of the present invention. The scope of thetechnical spirit of the present invention is not restricted by theembodiments, and the scope of the present invention should beinterpreted based on the appended claims. Accordingly, the presentinvention should be construed as covering all modifications orvariations induced from the meaning and scope of the appended claims andtheir equivalents.

1. An image decoding method, comprising: deriving a scale factor for acurrent block depending on whether or not the current block is atransform skip block; and performing scaling on the current block basedon the scale factor, wherein the scale factor for the current block isderived based on a location of a transform coefficient within thecurrent block, and the transform skip block is a block in whichtransform has not been applied to the current block and is specifiedbased on information indicative of whether or not to apply inversetransform to the current block.
 2. The image decoding method of claim 1,wherein deriving the scale factor for the current block comprisesderiving a basic scale factor irrespective of the location of thetransform coefficient within the current block if the current block isthe transform skip block.
 3. The image decoding method of claim 2,wherein: the basic scale factor has a specific scale factor value, andthe specific scale factor value is
 16. 4. The image decoding method ofclaim 2, wherein the basic scale factor has a different scale factorvalue depending on whether or not the current block uses a quantizationmatrix.
 5. The image decoding method of claim 2, wherein the basic scalefactor has a different scale factor value depending on whether thecurrent block is a luma block or a chroma block.
 6. The image decodingmethod of claim 1, wherein a flag indicating whether or not a transformskip algorithm is used in a picture comprising the current block issignaled through a Picture Parameter Set (PPS).
 7. The image decodingmethod of claim 6, wherein the basic scale factor comprises informationabout a scale factor for a luma signal and a chroma signal.
 8. The imagedecoding method of claim 1, wherein deriving the scale factor for thecurrent block comprises deriving a basic scale factor irrespective ofthe location of the transform coefficient within the current block ifthe current block is the transform skip block or the current block doesnot use a quantization matrix.
 9. The image decoding method of claim 1,wherein deriving the scale factor for the current block comprisesderiving the scale factor for the current block using a quantizationmatrix based on the location of the transform coefficient within thecurrent block if the current block is not a transform skip block.
 10. Animage decoding apparatus, comprising: a dequantization unit for derivinga scale factor for a current block depending on whether or not thecurrent block is a transform skip block and performing scaling on thecurrent block based on the scale factor, wherein the scale factor forthe current block is derived based on a location of a transformcoefficient within the current block, and the transform skip block is ablock in which transform has not been applied to the current block andis specified based on information indicative of whether or not to applyinverse transform to the current block.
 11. An image encoding method,comprising: deriving a scale factor for a current block depending onwhether or not the current block is a transform skip block; andperforming scaling on the current block based on the scale factor,wherein the scale factor for the current block is derived based on alocation of a transform coefficient within the current block, and thetransform skip block is a block in which transform has not been appliedto the current block and is specified based on information indicative ofwhether or not to apply inverse transform to the current block.
 12. Theimage encoding method of claim 11, wherein deriving the scale factor forthe current block comprises deriving a basic scale factor irrespectiveof the location of the transform coefficient within the current block ifthe current block is the transform skip block.
 13. The image encodingmethod of claim 12, wherein: the basic scale factor has a specific scalefactor value, and the specific scale factor value is
 16. 14. The imageencoding method of claim 12, wherein the basic scale factor has adifferent scale factor value depending on whether or not the currentblock uses a quantization matrix.
 15. The image encoding method of claim12, wherein the basic scale factor has a different scale factor valuedepending on whether the current block is a luma block or a chromablock.
 16. The image encoding method of claim 11, wherein a flagindicating whether or not a transform skip algorithm is used in apicture comprising the current block is signaled through a PictureParameter Set (PPS).
 17. The image encoding method of claim 16, whereinthe basic scale factor comprises information about a scale factor for aluma signal and a chroma signal.
 18. The image encoding method of claim11, wherein deriving the scale factor for the current block comprisesderiving a basic scale factor irrespective of the location of thetransform coefficient within the current block if the current block isthe transform skip block or the current block does not use aquantization matrix.
 19. The image encoding method of claim 11, whereinderiving the scale factor for the current block comprises deriving thescale factor for the current block using a quantization matrix based onthe location of the transform coefficient within the current block ifthe current block is not a transform skip block.
 20. An image encodingapparatus, comprising: a quantization unit for deriving a scale factorfor a current block depending on whether or not the current block is atransform skip block and performing scaling on the current block basedon the scale factor, wherein the scale factor for the current block isderived based on a location of a transform coefficient within thecurrent block, and the transform skip block is a block in whichtransform has not been applied to the current block and is specifiedbased on information indicative of whether or not to apply inversetransform to the current block.